remove deprecated function sleep_ms and change it to sleep(Duration::from_millis..)
authorSrinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
Thu, 12 May 2016 16:52:25 +0000 (22:22 +0530)
committerSrinivas Reddy Thatiparthy <thatiparthysreenivas@gmail.com>
Fri, 13 May 2016 00:10:20 +0000 (05:40 +0530)
tests/test_cargo_compile_custom_build.rs
tests/tests.rs

index b88963de4ecf9c0ffd4011a4caeded6b6d57e61b..78320de7d24d3154784c6d37d62c5ab3ea539463 100644 (file)
@@ -406,10 +406,11 @@ test!(rebuild_continues_to_pass_env_vars {
         "#)
         .file("src/lib.rs", "")
         .file("build.rs", r#"
+            use std::time::Duration;
             fn main() {
                 println!("cargo:foo=bar");
                 println!("cargo:bar=baz");
-                std::thread::sleep_ms(500);
+                std::thread::sleep(Duration::from_millis(500));
             }
         "#);
     a.build();
index c41cb9b3c25e444a015e7d1416e787e50ca1547c..a7142733e37047fa7e734b2634ba0234b35bfb1c 100644 (file)
@@ -20,6 +20,7 @@ extern crate log;
 
 use cargo::util::Rustc;
 use std::ffi::OsStr;
+use std::time::Duration;
 
 mod support;
 macro_rules! test {
@@ -107,7 +108,6 @@ fn cargo_process() -> cargo::util::ProcessBuilder {
     process(&support::cargo_dir().join("cargo"))
 }
 
-#[allow(deprecated)] // sleep_ms is now deprecated in favor of sleep()
-fn sleep_ms(ms: u32) {
-    std::thread::sleep_ms(ms);
+fn sleep_ms(ms: u64) {
+    std::thread::sleep(Duration::from_millis(ms));
 }